using pixolut.BizBlox;

public class StudentCollection : DOCollection
{

//START BizBlox Generated Code : Do not remove or alter this comment
//Last Updated : Thursday, 24 August 2006 4:57:09 PM
//BizBlox Version : 1.2.0.0
#region "BizBlox Generated Code"

    public StudentCollection() : base(new DOFactory((DataObject)new Student())) {
    }

    //to typecast your item() property
    public new Student this[int i]{
        get{
            return (Student)base[i];
        }
    }

#endregion
//END BizBlox Generated Code : Do not remove or alter this comment

	public void FindByStudentName(string name)
	{
		SQLBuilder mySql = base.GetSqlBuilder();
		mySql.addWhere(Student.Columns.Name, name);
        base.SetCurrentQuery(mySql);
		base.Find();
	}

	public void SearchByStudentName(string SearchTerm)
	{
		SQLBuilder mySql = base.GetSqlBuilder();
		if(SearchTerm != "")
		{
			SearchBuilder sb = new SearchBuilder(SearchTerm);
			mySql.addSearch(Student.Columns.Name, sb);
		}
        base.SetCurrentQuery(mySql);
		base.Find();
	}

	public void FindByNameEmailAge( string name, string email, int ageLower, int ageUpper ) 
	{ 
		SQLBuilder mySql = base.GetSqlBuilder(); 
		if ( name.Length > 0 ) 
		{ 
			SearchBuilder sb1 = new SearchBuilder( name ); 
			mySql.addSearch( Student.Columns.Name, sb1 ); 
			mySql.addAnd(); 
		} 
		if ( email.Length > 0 ) 
		{ 
			SearchBuilder sb2 = new SearchBuilder( email ); 
			mySql.addSearch( Student.Columns.Email, sb2 ); 
			mySql.addAnd(); 
		} 
		mySql.AddWhereGTE( Student.Columns.Age, ageLower.ToString() ); 
		mySql.addAnd(); 
		mySql.AddWhereLTE( Student.Columns.Age, ageUpper.ToString() );
        base.SetCurrentQuery(mySql);
		base.Find(); 
	} 

}